package org.akomantoso.core.data.other;

import java.io.IOException;

import org.akomantoso.core.data.MixedItem;
import org.akomantoso.core.io.Input;
import org.akomantoso.core.io.InputConstants;
import org.akomantoso.core.io.Output;
import org.akomantoso.core.visitor.AKVisitor;


/**
 * @author <a href="mailto:jacques.militello@gmail.com">Jacques Militello</a>
 */
public final class UnkownTag implements MixedItem{

	private final String _name;
	
	public UnkownTag(String name) {
		_name = name;
	}

	/**
	 * @see org.akomantoso.core.io.Externalizable#writeExternal(org.akomantoso.core.io.Output)
	 */
	@Override
	public <T extends Output> void writeExternal(T out) throws IOException {
		
	}

	/**
	 * @see org.akomantoso.core.io.Externalizable#readExternal(org.akomantoso.core.io.Input)
	 */
	@Override
	public <T extends Input> void readExternal(T in) throws IOException {
		while (true) {
			in.readNext();
			if (InputConstants.END_ELEMENT == in.getEventType() && _name.equals(in.getLocalName())) {
				break;
			}
		}
	}

	/**
	 * @see org.akomantoso.core.visitor.AKVisitable#accept(org.akomantoso.core.visitor.AKVisitor)
	 */
	@Override
	public void accept(AKVisitor visitor) {
		
	}

	
}